/**  
 * @Title:  patPractice0002.java   
 * @Package com.wkr.pat.basiclevel   
 * @Description:    TODO(用一句话描述该文件做什么)   
 * @author: WuKangrong     
 * @date:   2018年7月20日 上午11:34:17   
 * @version V
 * @JDKversion:1.8.0
 * @Copyright: 2018  
*/
package com.wkr.pat.basiclevel;
import java.util.Scanner;
/**   
 * @ClassName:  patPractice0002   
 * @Description:TODO(这里用一句话描述这个类的作用)   
 * @author: WuKangrong 
 * @date:   2018年7月20日 上午11:34:17     
 * @Copyright: 2018 
 */
public class patPractice0002 {
	/**
	 * @param in_IntGet int的包装类 
	 * @Description:TODO(借用Integer将int转换成String类型后再转换成char型数组再变为int型) 
	 */
	static Integer in_IntGet = 0;
	/**
	 * @param in_Int 控制台输入的值
	 */
	static int in_Int = 0;
	/**
	 * @param bit_Add 输入数值的各个位数值之和
	 */
	static int bit_Add = 0;
	
	/**   
	 * @Title: main   
	 * @Description: TODO(这里用一句话描述这个方法的作用)   
	 * @param: @param args      
	 * @return: void      
	 * @throws   
	 */
	public static void main(String[] args) {
		inNum();
		doBitAdd();
		printBitAddC();
	}
	
	/**   
	 * @Title: in_Num   
	 * @Description: TODO(输入交互函数)   
	 * @param:       
	 * @return: void      
	 * @throws   
	 */
	static void inNum()
	{
		Scanner input = new Scanner(System.in);
		System.out.print("请输入值：");
		in_Int = input.nextInt();
	}
	
	/**   
	 * @Title: doTest   
	 * @Description: TODO(实现输入数值各个位数值之和)   
	 * @param:       
	 * @return: void      
	 * @throws   
	 */
	static void doBitAdd()
	{
		/*while(in_Int / bit_Int != 0) {
			if(count ==0) {
				bit_Add = in_Int % 10 + bit_Add;
				in_Int = in_Int - bit_Add;
				bit_Int *= 10;
				count++;
			}else {
				bit_Add = in_Int / bit_Int + bit_Add;
				//in_Int = in_Int - bit_Add;
				bit_Int *= 10;
			}
			//System.out.println(bit_Int);
		}*/
		in_IntGet = in_Int;
		//int > String 
		in_IntGet.toString();
		//将String转char型数组
		 char[] num_Array = in_IntGet.toString().toCharArray();
		 for(int a_Length = 0; a_Length < num_Array.length; a_Length++) {
			//将char型数组里的数转换成int型
			 bit_Add = bit_Add + Character.getNumericValue(num_Array[a_Length]);
		 }
	}
	
	/**   
	 * @Title: printBitAddC   
	 * @Description: TODO(中文字符输出和的值)   
	 * @param:       
	 * @return: void      
	 * @throws   
	 */
	static void printBitAddC()
	{
		in_IntGet = bit_Add;
		in_IntGet.toString();
		//将得到的位和，变成char型数组
		char[] add_Array = in_IntGet.toString().toCharArray();
		//逐一输出位和里的每一位
		for(int a_Length = 0; a_Length < add_Array.length; a_Length++) {
			switch(add_Array[a_Length]) {
			case '0':
				System.out.print("零 ");
				break;
			case '1':
				System.out.print("壹 ");
				break;
			case '2':
				System.out.print("贰 ");
				break;
			case '3':
				System.out.print("叄 ");
				break;
			case '4':
				System.out.print("肆 ");
				break;
			case '5':
				System.out.print("伍 ");
				break;
			case '6':
				System.out.print("陆  ");
				break;
			case '7':
				System.out.print("柒 ");
				break;
			case '8':
				System.out.print("捌 ");
				break;
			case '9':
				System.out.print("玖 ");
				break;
			}
		}
	}

}
